SCMS=win32-ole hitchhikers 
OBJS=hitchhikers.o win32ole.o win32-ole.o hitchhikers_.o

GAMBIT=\Gambit-C\v4.4.0
CC=\mingw\bin\gcc
GSC=$(GAMBIT)\bin\gsc -:s -link 
LIBGSC=$(GAMBIT)\bin\gsc -:s -link -flat -o win-control.o1.c win32-ole
CFLAGS=-O2 -s -I$(GAMBIT)\include -L. -L$(GAMBIT)\lib
LIBFLAGS=-shared -D___DYNAMIC
LIBS=-lgambc -lws2_32 -lole32 -loleaut32 -loleacc -luuid -lstdc++

.SUFFIXES : .scm

all:
	@ $(MAKE) library
	@ $(MAKE) hitchhikers

clean:
	rm *.c
	rm *.o
	rm hitchhikers.exe
	rm win-control.o1

hitchhikers:	$(OBJS)
	$(CC) $(CFLAGS) $(OBJS) -o hitchhikers.exe $(LIBS)

library:	$(OBJS)
	$(CC) $(CFLAGS) $(LIBFLAGS) win-control.o1.c win32ole.cpp win32-ole.c -o win-control.o1 $(LIBS)

.scm.c:
	$(GSC) $(SCMS)
	$(LIBGSC)

.c.o:
	$(CC) $(CFLAGS) -c $<

.cpp.o:
	g++ $(CFLAGS) -c $<

